package com.book.demo.demo.service;

import com.book.demo.demo.model.LoginForm;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Service
public class UserService {
    /**
     * 用户业务逻辑层*/

    /**
     * 登陆信息校验*/
    public boolean loginInformationVerification(LoginForm loginForm, HttpSession session) {
        // 登录信息校验
        if("admin".equals(loginForm.getUserName()) && "admin".equals(loginForm.getPassword())) {
            // 登陆成功，在session中存储用户信息
            session.setAttribute("userName", loginForm.getUserName());
            return true;
        } else {
            return false;
        }
    }
}
